﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;

namespace SPlusres.Controller
{
    public class UCenterController : LoginController
    {
        /// <summary>
        /// Index View
        /// </summary>
        /// <returns></returns>
        public ViewResult Index()
        {
            return Information();
        }

        /*///////////////////////////////////////////////////////////////////////////////////////////////////////////
         * Change Password Action Group
        //////////////////////////////////////////////////////////////////////////////////////////////////////////*/
        #region Change Password Action Group

        /// <summary>
        /// Password View
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ViewResult Password()
        {
            return View("UserInfo/Password");
        }

        /// <summary>
        /// ChangePassword
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult Password(string Old, string New)
        {
            return Json(Business.Common.UserInfo.ChangePassword(userid, Old, New));
        }

        #endregion
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /*//////////////////////////////////////////////////////////////////////////////////////////////////////////
         * Information Action Group
        //////////////////////////////////////////////////////////////////////////////////////////////////////////*/
        #region Information Action Group

        /// <summary>
        /// Password View
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ViewResult Information()
        {
            return View("UserInfo/Information", Business.Common.UserInfo.Info(userid));
        }

        /// <summary>
        /// Password View
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult Information(Data.UserInfo model)
        {
            model.ID = userid;
            return Json(Business.Common.UserInfo.Info(model));
        }

        #endregion
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /*//////////////////////////////////////////////////////////////////////////////////////////////////////////
         * Material Action Group
        //////////////////////////////////////////////////////////////////////////////////////////////////////////*/
        #region Material Action Group

        /// <summary>
        /// UploadMaterial View
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ViewResult UploadMaterial()
        {
            return View("Material/UploadMaterial");
        }


        /// <summary>
        /// Password View
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult UploadMaterial(HttpPostedFileBase Filedata)
        {
            Filedata.SaveAs("c:\\1.png");

            return Json(true);
        }
        #endregion
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Welcome Page Action
        /// </summary>
        /// <returns></returns>
        public ViewResult Welcome()
        {
            return View();
        }
    }
}
